package com.fs.system.college_admin.controller;

import com.fs.system.college_admin.domain.Classes;
import com.fs.system.college_admin.domain.Grade;
import com.fs.system.college_admin.service.CollegeAdminGradeService;
import com.fs.system.common.ResponseData;
import com.fs.system.teacher.domain.Teacher;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/collegeAdminGrade")
public class CollegeAdminGradeContrller {
    @Autowired
    private CollegeAdminGradeService collegeAdminGradeService;

    /**
     * 查询年级列表
     * @return
     */
    @GetMapping("/getGrade")
    public ResponseData getGrade(Grade grade,
                                 @RequestParam(defaultValue = "1")Integer page,
                                 @RequestParam(defaultValue = "5")Integer size){
        PageInfo<Grade> list = collegeAdminGradeService.getGrade(grade,page,size);
        return new ResponseData("200","查询成功",list);
    }

    /**
     * 查询所有年级列表
     */
    @GetMapping("/getAllGrade")
    public ResponseData getAllGrade(Grade grade){
        List<Grade> list = collegeAdminGradeService.getAllGrade(grade);
        return new ResponseData("200","查询成功",list);
    }

    /**
     * 添加单个年级
     */
    @PostMapping("/addGrade")
    public ResponseData addGrade(@RequestBody Grade grade){
        collegeAdminGradeService.addGrade(grade);
        return new ResponseData("200","新增成功");
    }

    /**
     * 修改年级状态
     */
    @PutMapping("/modifyGrade")
    public ResponseData modifyGrade(@RequestBody Grade grade){
        System.out.println(grade);
        collegeAdminGradeService.modifyGrade(grade);
        return new ResponseData("200","修改成功");
    }


}
